package cn.edu.scau.cmi.linyiqu.javaFX;

import java.io.File;

import cn.edu.scau.cmi.linyiqu.client.AbstractFactoryClient;
import cn.edu.scau.cmi.linyiqu.client.AdapterClient;
import cn.edu.scau.cmi.linyiqu.client.ConsistentCompositeClient;
import cn.edu.scau.cmi.linyiqu.client.FactoryClient;
import cn.edu.scau.cmi.linyiqu.client.HibernateClient;
import cn.edu.scau.cmi.linyiqu.client.SafeCompositeClient;
import cn.edu.scau.cmi.linyiqu.client.SimpleFactoryClient;
import cn.edu.scau.cmi.linyiqu.client.SingletonClient;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class ComprehensionController {
	java.lang.Thread safeThread;
	java.lang.Thread consistentThread;
    @FXML
    private Button singletonButton;

    @FXML
    private Button simpleFactoryMethodButton;

    @FXML
    private Button factoryMethodButton;

    @FXML
    private Button hibernateButton;

    @FXML
    private Button consistentCompositeButton;

    @FXML
    private Button abstractFactoryButton;

    @FXML
    private Button adapterButton;

    @FXML
    private Button safeCompositeButton;

    @FXML
    public void singletonButtonOnClick() throws Exception {
    	new SingletonClient().start(new Stage());
    }

    @FXML
    public void simpleFactoryMethodButtonOnClick() throws Exception {
    	new SimpleFactoryClient().start(new Stage());
    }

    @FXML
    public void factoryMethodButtonOnClick() throws Exception{
    	new FactoryClient().start(new Stage());
    }

    @FXML
    public void abstractFactoryButtonOnClick() throws Exception{
    	new AbstractFactoryClient().start(new Stage());
    }

    @FXML
    public void adapterButtonOnClick() throws Exception{
    	new AdapterClient().start(new Stage());
    }

    @FXML
    public void safeCompositeButtonOnClick(){
    	safeThread = new java.lang.Thread(() -> {
        		SafeCompositeClient.main(null);
        });
    	safeThread.start();
    }

    @FXML
    public void consistentCompositeButtonOnClick(){
    	consistentThread = new java.lang.Thread(() -> {
    			ConsistentCompositeClient.main(null);
        });
    	consistentThread.start();
    }

    @FXML
    public void hibernateButtonOnClick() throws Exception{
    	new HibernateClient().start(new Stage());
    }
    
}
